package app.view;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class IMDBView extends javax.swing.JFrame {

	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	private JMenuBar appMenuBar;
	private JMenu appMenuFile;
	private JMenuItem loadDataset;
	private JLabel statusLabel;
	private JButton connectButton;
	private JTextField connectInput;
	private JLabel progressBarLabel;
	private JProgressBar progressBar;
	private JScrollPane jScrollPane1;
	private JTable resultTable;
	private JButton searchButton;
	private JTextField searchInputField;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			@Override
			public void run() {
				IMDBView inst = new IMDBView();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public IMDBView() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				appMenuBar = new JMenuBar();
				setJMenuBar(appMenuBar);
				{
					appMenuFile = new JMenu();
					appMenuBar.add(appMenuFile);
					appMenuFile.setText("File");
					{
						loadDataset = new JMenuItem();
						appMenuFile.add(loadDataset);
						loadDataset.setText("Load Dataset...");
					}
				}
			}
			pack();
			this.setSize(693, 337);
			this.setVisible(true);
			getContentPane().setLayout(null);
			{
				searchInputField = new JTextField();
				getContentPane().add(searchInputField);
				searchInputField.setBounds(21, 17, 116, 20);
			}
			{
				searchButton = new JButton();
				getContentPane().add(searchButton);
				searchButton.setText("Search");
				searchButton.setBounds(147, 15, 82, 23);
			}
			{
				jScrollPane1 = new JScrollPane();
				getContentPane().add(jScrollPane1);
				jScrollPane1.setBounds(21, 66, 636, 174);
				{
					TableModel resultTableModel = 
							new DefaultTableModel(
									new String[0][0],
									new String[] { "Search Results" });
					resultTable = new JTable();
					jScrollPane1.setViewportView(resultTable);
					resultTable.setModel(resultTableModel);
					//resultTable.setDefaultRenderer(Object.class, new HyperlinkCellRenderer());
					resultTable.setBounds(21, 71, 640, 175);
				}
			}
			{
				progressBar = new JProgressBar();
				getContentPane().add(getProgressBar());
				progressBar.setBounds(511, 253, 146, 14);
				progressBar.setVisible(false);
			}
			{
				progressBarLabel = new JLabel();
				getContentPane().add(progressBarLabel);
				progressBarLabel.setBounds(387, 250, 118, 19);
			}
			{
				connectInput = new JTextField();
				getContentPane().add(connectInput);
				connectInput.setBounds(458, 18, 113, 20);
			}
			{
				connectButton = new JButton();
				getContentPane().add(connectButton);
				{
					statusLabel = new JLabel();
					getContentPane().add(statusLabel);
					statusLabel.setBounds(21, 252, 162, 14);
				}
				connectButton.setText("Connect");
				connectButton.setBounds(581, 16, 73, 23);
			}
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}

	/**
	 * @return the statusLabel
	 */
	public JLabel getStatusLabel() {
		return statusLabel;
	}

	/**
	 * @param statusLabel the statusLabel to set
	 */
	public void setStatusLabel(JLabel statusLabel) {
		this.statusLabel = statusLabel;
	}

	/**
	 * @return the connectButton
	 */
	public JButton getConnectButton() {
		return connectButton;
	}

	/**
	 * @param connectButton the connectButton to set
	 */
	public void setConnectButton(JButton connectButton) {
		this.connectButton = connectButton;
	}

	/**
	 * @return the connectInput
	 */
	public JTextField getConnectInput() {
		return connectInput;
	}

	/**
	 * @param connectInput the connectInput to set
	 */
	public void setConnectInput(JTextField connectInput) {
		this.connectInput = connectInput;
	}

	/**
	 * @return the resultTable
	 */
	public JTable getResultTable() {
		return resultTable;
	}

	/**
	 * @param resultTable the resultTable to set
	 */
	public void setResultTable(JTable resultTable) {
		this.resultTable = resultTable;
	}

	/**
	 * @return the searchButton
	 */
	public JButton getSearchButton() {
		return searchButton;
	}

	/**
	 * @param searchButton the searchButton to set
	 */
	public void setSearchButton(JButton searchButton) {
		this.searchButton = searchButton;
	}

	/**
	 * @return the searchInputField
	 */
	public JTextField getSearchInputField() {
		return searchInputField;
	}

	/**
	 * @param searchInputField the searchInputField to set
	 */
	public void setSearchInputField(JTextField searchInputField) {
		this.searchInputField = searchInputField;
	}

	/**
	 * @return the appMenuBar
	 */
	public JMenuBar getAppMenuBar() {
		return appMenuBar;
	}

	/**
	 * @param appMenuBar the appMenuBar to set
	 */
	public void setAppMenuBar(JMenuBar appMenuBar) {
		this.appMenuBar = appMenuBar;
	}

	/**
	 * @return the appMenuFile
	 */
	public JMenu getAppMenuFile() {
		return appMenuFile;
	}

	/**
	 * @param appMenuFile the appMenuFile to set
	 */
	public void setAppMenuFile(JMenu appMenuFile) {
		this.appMenuFile = appMenuFile;
	}

	/**
	 * @return the loadDataset
	 */
	public JMenuItem getLoadDataset() {
		return loadDataset;
	}

	/**
	 * @param loadDataset the loadDataset to set
	 */
	public void setLoadDataset(JMenuItem loadDataset) {
		this.loadDataset = loadDataset;
	}
	
	public JProgressBar getProgressBar() {
		return progressBar;
	}

	public void activateProgressBar(String string) {
		progressBarLabel.setText(string);
		progressBarLabel.setVisible(true);
		progressBar.setIndeterminate(true);
		progressBar.setVisible(true);
	}
	
	public void deactivateProgressBar(String string){
		progressBarLabel.setText(string);
		progressBar.setIndeterminate(false);
		progressBar.setVisible(false);
	}

}
